package org.istt.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * District entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="TBL_DISTRICT"
    ,schema="dbo"
    ,catalog="onegate"
)

public class District  implements java.io.Serializable {


    // Fields    

     private Long id;
     private Province province;
     private String name;
     private Set<Village> villages = new HashSet<Village>(0);


    // Constructors

    /** default constructor */
    public District() {
    }

    
    /** full constructor */
    public District(Province province, String name, Set<Village> villages) {
        this.province = province;
        this.name = name;
        this.villages = villages;
    }

   
    // Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="ID", unique=true, nullable=false)

    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="PROVINCE_ID")

    public Province getProvince() {
        return this.province;
    }
    
    public void setProvince(Province province) {
        this.province = province;
    }
    
    @Column(name="NAME")

    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="district")

    public Set<Village> getVillages() {
        return this.villages;
    }
    
    public void setVillages(Set<Village> villages) {
        this.villages = villages;
    }
   








}